package com.jbh.recordlibrary.u;

import android.content.Context;
import android.util.Log;
import java.io.File;
public class SdcardUtil {


    /**
     * 本地文件保存路径
     *
     * @return
     */
    public static String getSaveDir(Context context) {

        String fileDir;

        /**
         * 判断SD卡是否存在
         */
        if (android.os.Environment.getExternalStorageState().equals(android.os.Environment.MEDIA_MOUNTED)) {
            File file=new File(context.getExternalFilesDir(null) +File.separator+ "yxjRecord");
            if(!file.exists()){
                file.mkdir();
            }
            fileDir = file.getPath();
        } else {
            Log.v("sdCard", "-------------->SD card not mounted!");
            File f = context.getCacheDir();
            fileDir = f.getPath();
        }
        return fileDir;
    }
}
